﻿using System.Collections.Generic;
using ShopB2C.Helper;
using ShopB2C.Interfaces;
using System.Web.Routing;

namespace ShopB2C.Controllers.Manager {
    /// <summary>
    /// 分类
    /// </summary>
    public partial class ClassifyController : BaseController {

        private static IClassify _classify;
        private static List<ClassifyConfig> _classifyConfig;

        public ClassifyController() {
            this.PageSize = 15;            
            _classifyConfig = new List<ClassifyConfig>(3);
            _classifyConfig.Add(new ClassifyConfig() {
                ModuleKey = "Product",
                ModuleName = "商品分类",
                IsAllowHasProperty = true,
                IsAllowHasChild = true
            });
            _classifyConfig.Add(new ClassifyConfig() {
                ModuleKey = "News",
                ModuleName = "新闻分类",
                IsAllowHasProperty = false,
                IsAllowHasChild = false
            });
            _classifyConfig.Add(new ClassifyConfig() {
                ModuleKey = "Brands",
                ModuleName = "品牌分类",
                IsAllowHasProperty = false,
                IsAllowHasChild = false
            });
            _classify = DataBaseExecuter.CreateClassByName<IClassify>("Classify");
        }

    }

    /// <summary>
    /// 分类配置
    /// </summary>
    public class ClassifyConfig {
        /// <summary>
        /// 模块关键字
        /// </summary>
        public string ModuleKey { get; set; }
        /// <summary>
        /// 模块名称
        /// </summary>
        public string ModuleName { get; set; }
        /// <summary>
        /// 是否允许有特性
        /// </summary>
        public bool IsAllowHasProperty { get; set; }
        /// <summary>
        /// 是否允许有子分类
        /// </summary>
        public bool IsAllowHasChild { get; set; }
    }
}